import request from 'lib/request';

// 获取最近消息列表
export function queryMessageList(patientId) {

  let body ={
    patientId
  }
  return request("wechat/dpatient/message/patientMsgList?"+"patientId="+patientId,{
    method: 'GET',
  })
}

// 获取发送信息的医生列表
export function queryDoctorList(patientId) {
  let body ={
    patientId
  }
   return request("wechat/dpatient/message/getDoctors?"+"patientId="+patientId,{
    method: 'GET',
  })
}

// 获取与医生聊天记录
export function queryMessageDetail(patientId, doctorId, page, size) {
  let body ={
    patientId,
    doctorId,
    page,
    size,
  }
   return request("wechat/dpatient/message/chat?"+"patientId="+patientId+"&doctorId="+doctorId+"&page="+page+"&size="+size,{
    method: 'GET',
  })
}

// 发送文字消息
// data: { doctorid, text }
export function sendTextMessage(data) {
  const body = new FormData();
  Object.keys(data).forEach(key => body.append(key, data[key]));
  return request.post('wechat/dpatient/message/sendText', { body });
}

// 发送图片消息
export function sendImageMessage(data) {
  const body = new FormData();
  Object.keys(data).forEach(key => body.append(key, data[key]));
  return request.post('wechat/dpatient/message/sendPic', { body });
}



